﻿using MediatR;
using T.Contract.Domain.T.Contract.Model;
using T.Contract.Read.API.Application.Command.ContractCommand;
using T.Contract.Repository.Interface;

namespace T.Contract.Read.API.Application.CommandHandlers.ContractHandler
{
    public class ContractBackfillCommandHandler : IRequestHandler<ContractBackfillCommand, ContractModel>
    {
        protected readonly IContractRepository contractRepository;

        public ContractBackfillCommandHandler(IContractRepository contractRepository)
        {
            this.contractRepository = contractRepository;
        }

        public Task<ContractModel> Handle(ContractBackfillCommand request, CancellationToken cancellationToken)
        {
            var id = request.ContractId;
            var res = contractRepository.GetModelAsync(id);
            return res;
        }
    }
}
